enum

hidden abstract type enum

An enum is a set of member constants who share a type.

The declaration enum example { A, B, C } defines a type example, with three member constants, example.A, example.B and example.C.

Enum names and member constant names follow the same rules as all identifiers in Rell. However, by convention, enum names use snake_case, and member constants use UPPER_SNAKE_CASE.

Examples:

  • enum primary_color { RED, BLUE, GREEN }

  • enum error { TIMEOUT, MALFORMED_RESPONSE, NOT_FOUND, UNAUTHORIZED, UNKNOWN }

  • enum cardinal_direction { NORTH, EAST, SOUTH, WEST }

Since

0.7.0